var Table = Backbone.View.extend({
	el: 'body',
	initialize: function() {
		this.orderView = new OrderView({id: 'orders'});
		this.itemsView = new ItemsView({id: 'table'}, this.orderView);
	},
	render: function(model) {

		this.$el.empty();
		this.itemsView.fetch();
		this.$el.append(this.itemsView.el);
		
		var self = this;
		this.orderView = new OrderView({id: 'orders'});
		$.ajax({
			url: basePath + '/order/' + model.model.get('TableID') +'?key=' + router.apikey,
			type: 'get',
			dataType: 'json',
			success: function(returnValue) {
				self.orderView.renderResponse(returnValue.data.itemsId, self.itemsView.collection);
			},
			error: 	function() {
				alert('Error');
			}
		});
		this.$el.append(this.orderView.el);	
		
	}
});